/*EUmCqcPbhnWgPeYJnITu6Hjm6RDoVQzFcPj+B1PqodJaBoJNcRnz7ZFd0y7qztkn*/
/*ELzNWGi3Qs3VfoABf8J7JvcI5j+fWjv4o1NOLHbCYME=*/
/*
 * @Author: CongKe 
 * @PageInfo: 采购订单提交 
 * @Date: 2018-06-20 18:23:03 
 * @Last Modified by: CongKe
 * @Last Modified time: 2019-01-03 15:27:44
 */
import { URL, FIELD, PAGECODE, POYUTIC } from '../../constance';
import { ajax, toast } from 'nc-lightapp-front';
import { showBatchOprMessage, showSuccessInfo } from '../../../../../scmpub/scmpub/pub/tool/messageUtil';
import { updateCacheDataForList } from '../../../../../scmpub/scmpub/pub/cache';
import { getLangByResId } from '../../../../../scmpub/scmpub/pub/tool/multiLangUtil';
import { buttonController } from '../viewController/index';

export default function puyutiBtnClick(props, record, index, assign) {
	// 获取选中行
	// 执行提交操作
	let _this = this;
	let pks = [];
	let dataRows = [];
	let indexs = [];
	if (record && record.pk_order) {
		pks.push(record.pk_order.value);
		// let info = {
		// 	pks: record.pk_order.value,
		// 	ts: record.ts.value
		// };
		// dataRows.push(info);
		// indexs.push(record.numberindex && record.numberindex.value - 1);
	} else {
		let rows = props.table.getCheckedRows(PAGECODE.tableId);
		// 如果没有选中行，则提示并返回，不进行任何操作
		if (rows.length <= 0) {
			toast({
				color: 'warning',
				content: '请选择需要处理的数据'
			});
			return;
		}
		rows.map((item) => {
			pks.push(item.data.values.pk_order.value);
			// let info = {
			// 	pks: item.data.values.pk_order.value,
			// 	ts: item.data.values.ts.value
			// };
			// dataRows.push(info);
			// indexs.push(item.index);
		});
		//批量处理需把索引号置空
		indexs = null;
	}

	// 拼装json
	// let data = {
	// 	closedto: dataRows,
	// 	pagecode: PAGECODE.listcode,
	// 	extstr: ''
	// };
	let data = {
		pks : pks,
		pageid : POYUTIC.PAGECODE
	}

	this.setState({pk_orders: pks, showPoyutiModal: true });

	//指派
	// if (assign) {
	// 	data['assign'] = JSON.stringify(assign);
	// }
	// 发送请求
	// ajax({
	// 	url: URL.ytmxquery,
	// 	data: data,
	// 	success: (res) => {
	// 		let { success, data } = res;
	// 		let rowsData = { rows: [] };
	// 		if (data) {
	// 			rowsData = data[POYUTIC.TABLEID];
	// 		}
	// 		// rowsData.rows.forEach((row) => {
	// 		// 	row.values.crownobb1.display = row.values.crownobb1.value;
	// 		// });
	// 		this.props.editTable.setTableData(POYUTIC.TABLEID, rowsData);

	// 		this.setState({showPoyutiModal: true });
	// 	}
	// });
}

/*ELzNWGi3Qs3VfoABf8J7JvcI5j+fWjv4o1NOLHbCYME=*/
/*EUmCqcPbhnWgPeYJnITu6Hjm6RDoVQzFcPj+B1PqodJaBoJNcRnz7ZFd0y7qztkn*/